local Hunzi = fk.CreateSkill({
  name = "gai__hunzi",
  tags = { Skill.Wake },
})

Fk:loadTranslationTable{
  ["gai__hunzi"] = "魂姿",
  [":gai__hunzi"] = "觉醒技，当你进入濒死状态时，回复至1点体力，你减1点体力上限，获得1点护甲，摸三张牌，修改〖激昂〗（将“出牌阶段限一次”改为“出牌阶段限X次（X为吴势力角色数）”），然后获得〖英姿〗和〖英魂〗。",

  ["$gai__hunzi1"] = "父亲在上，魂佑江东；公瑾在旁，智定天下！",
  ["$gai__hunzi2"] = "愿承父志，与公瑾共谋天下！",
}

Hunzi:addEffect(fk.EnterDying, {
  can_trigger = function(self, event, target, player, data)
    return
      target == player and
      player:hasSkill(Hunzi.name) and
      player:usedSkillTimes(Hunzi.name, Player.HistoryGame) == 0
  end,
  can_wake = Util.TrueFunc,
  on_use = function(self, event, target, player, data)
    local room = player.room
    if player.hp < 1 then
      room:recover{
        who = player,
        num = 1 - player.hp,
        recoverBy = player,
        skillName = Hunzi.name
      }
    end
    room:changeMaxHp(player, -1)
    if player.dead then return false end
    room:changeShield(player, 1)
    if player.dead then return false end
    room:drawCards(player, 3, Hunzi.name)
    if player.dead then return false end
    room:handleAddLoseSkills(player, "mou__yingzi|yinghun", nil, true, false)
  end,
})

return Hunzi
